Led drive circuit with a programmable input for led lighting

ABSTRACT

An LED drive circuit includes a controller, generating a switching signal to switch a magnetic device that receives an input voltage derived from an input of the LED drive circuit, for generating an output current to drive at least a LED. The controller includes an input circuit receiving a programmable signal correlated to the input of the LED drive circuit to generate a programmable current, the programmable current modulating a current input signal correlated to a switching current of the magnetic device to form a modulated current input signal, and a comparison circuit comparing a signal sourced from an oscillator and a voltage potential generated in response to the modulated current input signal for generating a current control signal. The switching signal is controlled in response to the current control signal for regulating the output current, and a level of the output current is correlated to the current control signal.

This application is a continuation of application Ser. No. 14/725,459,which is a continuation-in-part of application Ser. No. 14/261,613,filed Apr. 25, 2014, now U.S. Pat. No. 9,049,764, issued Jun. 2, 2015,which is a continuation of application Ser. No. 12/978,836, filed Dec.27, 2010, now U.S. Pat. No. 8,742,677, which was based on ProvisionalApplication No. 61,335,749, filed Jan. 11, 2010.

BACKGROUND Field of the Disclosure

The present invention relates to a LED lighting, and more particularly,the present invention relates to a switching regulator with programmableinput.

Description of Related Art

The LED driver is used to control the brightness of the LED inaccordance with its characteristics. The LED driver is also utilized tocontrol the current that flows through the LED. The present inventionprovides a primary-side controlled switching regulator with aprogrammable input for a LED driver. One object of this invention is toimprove the power factor (PF) of the LED driver. The programmable inputcan also be used for the dimming control. It is another object of theinvention.

SUMMARY OF THE INVENTION

It is an objective of the present invention to provide a LED drivecircuit with programmable input. It can modulate the switching signal toregulate the output current for improving the power factor (PF) of theLED drive circuit.

It is an objective of the present invention to provide a LED drivecircuit with programmable input. The programmable input can be used forthe dimming control.

The LED drive circuit according to the present invention comprises acontroller and a programmable signal. The controller generates aswitching signal coupled to switch a magnetic device for generating anoutput current to drive a plurality of LEDs. The programmable signal iscoupled to regulate a current-control signal of the controller. Theswitching signal is modulated in response to the current-control signalfor regulating the output current. The level of the output current iscorrelated to the current-control signal. Further, the programmablesignal is coupled to control a reference signal of the controller. Theswitching signal is modulated in response to the reference signal. Thelevel of the output current is correlated to the reference signal.

The LED driver according to the present invention comprises a controllerand a programmable signal. The controller generates a switching signalcoupled to switch a transformer for generating a current input signalcoupled to the controller and an output current connected to drive aplurality of LEDs. The programmable signal is coupled to modulate thecurrent input signal. The current input signal is further coupled togenerate a current-control signal. The current input signal iscorrelated to a switching current of the transformer. The switchingsignal is controlled in response to the current-control signal. Thelevel of the output current is correlated to the current-control signal.

BRIEF DESCRIPTION OF ACCOMPANIED DRAWINGS

The accompanying drawings are included to provide a furtherunderstanding of the present invention, and are incorporated in andconstitute a part of this specification. The drawings illustrateembodiments of the present invention and, together with the description,serve to explain the principles of the present invention. In thedrawings,

FIG. 1 shows a circuit diagram of a preferred embodiment of a LED drivecircuit in accordance with the present invention.

FIG. 2 is another preferred embodiment of the LED drive circuit inaccordance with the present invention.

FIG. 3 is a preferred embodiment of the controller in accordance withthe present invention.

FIG. 4 is a preferred embodiment of the integrator in accordance withthe present invention.

FIG. 5 shows a preferred embodiment of the maximum duty circuit inaccordance with the present invention.

FIG. 6 is another preferred embodiment of the controller in accordancewith the present invention.

FIG. 7 shows a preferred embodiment of the voltage-to-current converterin accordance with the present invention.

DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS

FIG. 1 is a circuit diagram of a preferred embodiment of a LED drivecircuit in accordance with the present invention. The LED drive circuit,which is presently preferred to be a LED circuit or a LED driver. Anoffline transformer 10 is a magnetic device including a primary windingN_(P), an auxiliary winding N_(A) and a secondary winding N_(S). Oneterminal of the primary winding N_(P) is coupled to receive an inputvoltage V_(IN). The other terminal of the primary winding N_(P) iscoupled to a drain terminal of a power transistor 20. The powertransistor 20 is utilized to switch the offline transformer 10. Oneterminal of the secondary winding N_(S) connects one terminal of arectifier 40. A filter capacitor 45 is coupled between the otherterminal of the rectifier 40 and the other terminal of the secondarywinding N_(S). A plurality of LEDs 101 . . . 109 are connected in seriesand connected to the filter capacitor 45 in parallel.

A controller 70 comprises a supply terminal VCC, a voltage-detectionterminal VDET, a ground terminal GND, a current-sense terminal VS, aninput terminal VCNT and an output terminal VPWM. The controller 70 is aprimary-side controller that is coupled to control the power transistor20 for switching the primary winding N_(P) of the magnetic device. Thevoltage-detection terminal VDET is coupled to the auxiliary windingN_(A) via a resistor 50 to receive a voltage-detection signal V_(DET)for detecting a reflected voltage V_(AUX). The voltage-detection signalV_(DET) is correlated to the reflected voltage V_(AUX). The reflectedvoltage V_(AUX) further charges a capacitor 65 via a rectifier 60 forpowering the controller 70. The capacitor 65 is coupled to the supplyterminal VCC of the controller 70.

The current-sense terminal VS is coupled to a current-sense resistor 30.The current-sense resistor 30 is coupled from a source terminal of thepower transistor 20 to a ground for converting a switching current I_(P)of the magnetic device to a current input signal V_(IP). . . Theswitching current I_(P) flows the power transistor 20. The outputterminal VPWM outputs a switching signal V_(PMV) to switch the offlinetransformer 10. The controller 70 generates the switching signal V_(PMV)to switch the magnetic device through the power transistor 20 forgenerating an output current I_(O) and controlling the switching currentI_(P). The output current I_(O) is coupled to drive LEDs 101 . . . 109.The input terminal VCNT receives a programmable signal V_(CNT) tocontrol the switching current I_(P) and the output current I_(O) .

FIG. 2 is another preferred embodiment of the LED drive circuit inaccordance with the present invention. Comparing with FIG. 1 and FIG. 2,the primary winding N_(P) is coupled to receive the input voltage V_(IN)rectified and filtered by a bridge rectifier 80 and a bulk capacitor 89from an AC input V_(AC). The AC input V_(AC) is coupled to an input ofthe bridge rectifier 80. The bulk capacitor 89 is coupled between anoutput of the bridge rectifier 80 and the ground. Moreover, theprogrammable signal V_(CNT) is generated at the input terminal VCNT inresponse to the AC input V_(AC) of the LED drive circuit through diodes81 and 82, a voltage divider formed by resistors 85 and 86, a filtercapacitor 87. Anodes of the diodes 81 and 82 are coupled to receive theAC input V_(AC). One terminal of the resistor 85 is coupled to cathodesof the diodes 81 and 82. The resistor 86 is connected between the otherterminal of the resistor 85 and the ground. The filter capacitor 87 isconnected to the resistor 86 in parallel. The filter capacitor 87 isfurther coupled to the input terminal VCNT. Other circuits of thisembodiment are the same as the embodiment of FIG. 1, so here is no needto describe again.

FIG. 3 is a preferred embodiment of the controller in accordance withthe present invention. The controller 70 is a primary-side controllercoupled to switch the primary winding N_(P) of the offline transformer10. The detail description of the primary-side controlled regulator canbe found in a prior art “Control circuit for controlling output currentat the primary side of a power converter” U.S. Pat. No. 6,977,824.

A waveform detector 300 detects the witching current I_(P) (as shown inFIG. 1) and generates current-waveform signals V_(A) and V_(B) bysampling the current input signal V_(IP)through the current-senseterminal VS. The waveform detector 300 further receives the switchingsignal V_(PWM), a pulse signal PLS and a clear signal CLR. Adischarge-time detector 100 receives the voltage-detection signalV_(DET) via the auxiliary winding N_(A) (as shown in FIG. 1) to detectthe discharge-time of a secondary side switching current I_(S) andgenerate a discharge-time signal S_(DS). The secondary side switchingcurrent I_(S) is proportional to the switching current I_(P). The pulsewidth of the discharge-time signal S_(DS) is correlated to thedischarge-time of the secondary side switching current I_(S). The outputcurrent I_(O) is correlated to the secondary side switching currentI_(S). An oscillator (OSC) 200 generates the pulse signal PLS coupled toa PWM circuit 400 to determine the switching frequency of the switchingsignal V_(PWM). The oscillator 200 further generates the clear signalCLR that is coupled to the waveform detector 300 and an integrator 500.

The integrator 500 is used to generate a current signal V_(Y) byintegrating an average current signal I_(AVG) (as shown in FIG. 4) withthe discharge-time signal S_(DS). The average current signal I_(AVG) isproduced in response to the current-waveform signals V_(A) and V_(B). Atime constant of the integrator 500 is correlated with a switchingperiod T of the switching signal V_(PWM). The current signal V_(Y) istherefore related to the output current I_(O). A n operational amplifier71 and a reference signal V_(REF1) develop an error amplifier for outputcurrent control. A positive input of the operational amplifier 71 iscoupled to receive the reference signal V_(REF1). A negative input ofthe operational amplifier 71 is coupled to receive the current signalV_(Y). The error amplifier amplifies the current signal V_(Y) andprovides a loop gain for output current control.

A comparator 75 is associated with the PWM circuit 400 for controllingthe pulse width of the switching signal V_(PWM) in response to an outputof the error amplifier. A positive input and a negative input of thecomparator 75 are coupled to receive the output of the error amplifierand a ramp signal RMP respectively. The ramp signal RMP is provided bythe oscillator 200. An output of the comparator 75 generates acurrent-control signal S_(I) for controlling the pulse width of theswitching signal V_(PWM). A current control loop is formed fromdetecting the switching current I_(P) to modulate the pulse width of theswitching signal V_(PWM). The current control loop controls themagnitude of the switching current I_(P) in response to the referencesignal V_(REF1).

The PWM circuit 400 outputs the switching signal V_(PWM) for switchingthe offline transformer 10. The PWM circuit 400 according to oneembodiment of the present invention comprises a D flip-flop 95. aninverter 93, an AND gate 91 and an AND gate 92. AD input of the Dflip-flop 95 is supplied with a supply voltage V_(CC). An output of theinverter 93 is coupled to a clock input CK of the D flip-flop 95. Thepulse signal PLS sets the D flip-flop 95 through the inverter 93. Anoutput Q of the D flip-flop 95 is coupled to a first input of the ANDgate 92. A second input of the AND gate 92 is coupled to the output ofthe inverter 93 and receives the pulse signal PLS through the inverter93. An output of the AND gate 92 is also an output of the PWM circuit400 that generates the switching signal V_(PWM). The D flip-flop 95 isreset by an output of the AND gate 91.

A first input of the AND gate 91 is supplied with a voltage-controlsignal S_(V). The voltage-control signal S_(V) is generated by a voltagecontrol loop, in which the voltage control loop is utilized to regulatethe output voltage V_(O). A second input of the AND gate 91 is coupledto receive the current-control signal S_(I) for achieving output currentcontrol. A third input of the AND gate 91 is coupled to receive amaximum-duty signal S_(M). The voltage-control signal S_(V), thecurrent-control signal S_(I) and the maximum-duty signal S_(M) can resetthe D flip-flop 95 for shorten the pulse width of the switching signalV_(PWM) so as to regulate the output voltage V_(O) and the outputcurrent I_(O). The maximum-duty signal S_(M) is generated by a maximumduty circuit (DMAX) 650. The maximum duty circuit 650 can be utilized tolimit the maximum-duty of the switching signal V_(PWM) under 50%.

A positive input of a comparator 700 is coupled to receive a detectsignal α V_(IN). A low-voltage threshold V_(TH) is supplied with anegative input of the comparator 700. An enable signal S_(EN) isgenerated at an output of the comparator 700 by comparing the detectsignal α V_(IN) with the low-voltage threshold V_(TH). The detect signala V_(IN) is correlated to the input voltage V_(IN). The output of thecomparator 700 generates the enable signal S_(EN) coupled to control anAND gate 710. Two inputs of the AND gate 710 receives the pulse signalPLS and the enable signal S_(EN) respectively. An output of the AND gate710 generates a sample signal S_(P) coupled to the integrator 500. Thedetail description for input voltage V_(IN) detection can be found inprior arts “Control method and circuit with indirect input voltagedetection by switching current slope detection” U.S. Pat. No. 7,616,461and “Detection circuit to detect input voltage of transformer anddetection method for the same” U.S. 2008/0048633 A1.

The programmable signal V_(CNT) generated at the input terminal VCNT issupplied to a positive input of a buffer amplifier 720. A negative inputof the buffer amplifier 720 is connected to its output. A resistor 730is coupled between the output of the buffer amplifier 720 and areference voltage device 750. The reference voltage device 750 isconnected to the reference signal V_(REF1) to clamp the maximum voltageof the reference signal V_(REF1) . The reference voltage device 750 canbe implemented by a zener diode. The programmable signal V_(CNT) iscoupled to regulate the current-control signal S_(I) of the controller70 through controlling the reference signal V_(REF1) of a current-loop.Furthermore, the programmable signal V_(CNT) is coupled to control thereference signal V_(REF1) of the current-loop of the controller 70. Theswitching signal V_(PWM) is modulated in response to the current-controlsignal S_(I) for regulating the output current I_(O), and the level ofthe output current I_(O) is correlated to the current-control signalS_(I). In other words, the switching signal V_(PWM) is modulated inresponse to the reference signal V_(REF1), and the level of the outputcurrent I_(O) is correlated to the reference signal V_(REF1).

FIG. 4 is a preferred embodiment of the integrator in accordance withthe present invention. An amplifier 510, a resistor 511 and a transistor512 construct a first V-to-I converter to generate a first current I₅₁₂in response to the current-waveform signal V_(B). A positive input ofthe amplifier 510 is supplied with the current-waveform signal V_(B). Anegative input of the amplifier 510 is coupled to a source terminal ofthe transistor 512 and one terminal of the resistor 511. The otherterminal of the resistor 511 is coupled to the ground. An output of theamplifier 510 is coupled to a gate terminal of the transistor 512. Adrain terminal of the transistor 512 generates the first current I₅₁₂.

Transistors 514, 515 and 519 form a first current mirror for producing acurrent I₅₁₅ and a current I₅₁₉ by mirroring the first current I₅₁₂.Source terminals of the transistors 514, 515 and 519 of the firstcurrent mirror are coupled to the supply voltage V_(CC). Gate terminalsof the transistors 514, 515, 519 and drain terminals of the transistors512, 514 are connected together. Drain terminals of the transistors 515and 519 generate the current I₅₁₅ and I₅₁₉ respectively. Transistors 516and 517 form a second current mirror for generating a current I₅₁₇ bymirroring the current I₅₁₅. Source terminals of the transistors 516 and517 of the second current mirror are coupled to the ground. Gateterminals of the transistors 516, 517 and drain terminals of thetransistors 516, 515 are connected together. A drain terminal of thetransistor 517 generates the current I₅₁₇.

An amplifier 530, a resistor 531 and a transistor 532 form a secondV-to-I converter for generating a second current I₅₃₂ in response to thecurrent-waveform signal V_(A). A positive input of the amplifier 530 issupplied with the current-waveform signal V_(A). A negative input of theamplifier 530 is coupled to a source terminal of the transistor 532 andone terminal of the resistor 531. The other terminal of the resistor 531is coupled to the ground. An output of the amplifier 530 is coupled to agate terminal of the transistor 532. A drain terminal of the transistor532 generates the second current I₅₃₂. Transistors 534 and 535 form athird current mirror for producing a current I₅₃₅ by mirroring thesecond current I₅₃₂. Source terminals of the transistors 534 and 535 ofthe third current mirror are coupled to the supply voltage V_(CC). Gateterminals of the transistors 534, 535 and drain terminals of thetransistors 532, 534 are connected together. A drain terminal of thetransistor 535 generates the current I₅₃₅.

Transistors 536 and 537 develop a fourth current mirror for producing acurrent I₅₃₇ in response to the current I₅₃₅ and the current I₅₁₇.Source terminals of the transistors 536 and 537 of the fourth currentmirror are coupled to the ground. Gate terminals of the transistors 536,537 and drain terminals of the transistors 536, 535 are connectedtogether. The drain terminal of the transistor 536 and a drain terminalof the transistor 537 generate a current I₅₃₆ and the current I₅₃₇respectively. The current I₅₃₆ can be expressed by I₅₃₆=I₅₃₅−I₅₁₇. Thegeometric size of the transistor 536 is twice the size of the transistor537. Therefore the current I₅₃₇ is the current I₅₃₆ divided by 2.Transistors 538 and 539 form a fifth current mirror for generating acurrent I₅₃₉ by mirroring the current I₅₃₇. Source terminals of thetransistors 538 and 539 of the fifth current mirror are coupled to thesupply voltage V_(CC). Gate terminals of the transistors 538, 539 anddrain terminals of the transistors 538, 537 are connected together. Adrain terminal of the transistor 539 generates the current I₅₃₉. Thedrains of the transistor 519 and the transistor 539 are coupled togetherfor generating the average current signal I_(AVG) by summing the currentI₅₁₉ and the current I₅₃₉. A current feedback signal V_(X) is thereforegenerated at the drain terminals of the transistor 519 and thetransistor 539. The resistor 511, the resistor 531 and a capacitor 570determine the time constant of the integrator 500, and the resistor 531is correlated to the resistor 511.

A switch 550 is coupled between the drain terminal of the transistor 519and the capacitor 570. The switch 550 is controlled by thedischarge-time signal S_(DS) and turned on only during the period of thedischarge-time of the secondary side switching current I_(S). Atransistor 560 is coupled to the capacitor 570 in parallel to dischargethe capacitor 570. The transistor 560 is turned on by the clear signalCLR. The integrator 500 further includes a sample-and-hold circuitformed by a sample switch 551 and an output capacitor 571. The sampleswitch 551 is coupled between the capacitor 570 and the output capacitor571. The switch 551 controlled by the sample signal S_(P) serves toperiodically sample the voltage across the capacitor 570 to the outputcapacitor 571. The current signal V_(Y) is therefore generated acrossthe output capacitor 571. The sample-and-hold circuit is coupled tosample the current feedback signal V_(X) for generating thecurrent-control signal S_(I) (as shown in FIG. 3). The current feedbacksignal V_(X) is correlated to the switching current I_(P) of the offlinetransformer 10 (as shown in FIG. 1). In other words, the sample-and-holdcircuit is coupled to sample the current input signal V_(IP). (as shownin FIG. 1) for generating the current-control signal S_(I). As shown inFIG. 3, the sample-and-hold circuit will stop sampling the currentfeedback signal V_(X) once the input voltage V_(IN) of the drive circuitis lower than the low-voltage threshold V_(TH). In other words, thesample-and-hold circuit will stop sampling the current feedback signalV_(X) once the AC input V_(AC) (as shown in FIG. 2) is lower than thelow-voltage threshold V_(TH). The AND gate 710 generates the samplesignal S_(P) for sampling of the current feedback signal V_(X).

FIG. 5 shows a preferred embodiment of the maximum duty circuit 650 inaccordance with the present invention. The maximum duty circuit 650includes an inverter 670, a transistor 671, a current source 675, acapacitor 680 and a comparator 690. A gate terminal of the transistor671 receives the switching signal V_(PWM) through the inverter 670. Theswitching signal V_(PWM) is coupled to control the transistor 671. Thecurrent source 675 is coupled between the supply voltage V_(CC) and adrain terminal of the transistor 671. A source terminal of thetransistor 671 is coupled to the ground. The capacitor 680 is connectedbetween the drain terminal of the transistor 671 and the ground. Thetransistor 671 is coupled to the capacitor 680 in parallel to dischargethe capacitor 680 when the switching signal V_(PWM) is disabled. Thecurrent source 675 is connected to the supply voltage V_(CC) and is usedto charge the capacitor 680 when the switching signal V_(PWM) isenabled. The current source 675 and the capacitance of the capacitor 680determine the pulse-width and the amplitude of the voltage across thecapacitor 680. A negative input of the comparator 690 is coupled to thedrain terminal of the transistor 671 and the capacitor 680. A referencesignal V_(REF3) is supplied to a positive input of the comparator 690.An output of the comparator 690 generates the maximum duty signal S_(M).To set up the reference signal V_(REF3) appropriately, the maximum dutycircuit 650 can be utilized to limit the maximum-duty of the switchingsignal V_(PWM) under 50%.

FIG. 6 is another preferred embodiment of the controller 70 inaccordance with the present invention. The controller 70 generates theswitching signal V_(PWM) coupled to switch the offline transformer 10for generating the current input signal V_(IP). (as shown in FIG. 1). Apositive input of a buffer amplifier 780 receives the current inputsignal V_(IP). A negative input of the buffer amplifier 780 is coupledto its output. A voltage-to-current converter 800 receives theprogrammable signal V_(CNT) to generate a programmable current I_(CNT).A resistor 790 is coupled between the output of the buffer amplifier 780and the output of the voltage-to-current converter 800. The resistor 790and the output of the voltage-to-current converter 800 are furthercoupled to the input of the waveform detector 300. The programmablecurrent I_(CNT) is further coupled to the current-sense terminal VS (asshown in FIG. 1) via the resistor 790 and the buffer amplifier 780 formodulating the current input signal V_(IP). Hence, the programmablesignal V_(CNT) generated at the input terminal V_(CNT) is coupled tomodulate the current input signal V_(IP). Referring to the FIG. 3, thecurrent input signal V_(IP) is further coupled to generate thecurrent-control signal S_(I). The current input signal V_(IP) iscorrelated to the switching current I_(P) of the offline transformer 10and the programmable signal V_(CNT). The switching signal V_(PWM) iscontrolled in response to the current-control signal S_(I), thus thelevel of the output current I_(O) is correlated to the current-controlsignal S_(I).

FIG. 7 shows a preferred embodiment of the voltage-to-current converter800 in accordance with the present invention. The voltage-to-currentconverter 800 comprises an amplifier 810. a resistor 825, a transistor820, a first current mirror formed by transistors 830, 831, a currentsource 850, a second current mirror formed by transistors 832. 833. Apositive input of the amplifier 810 receives the programmable signalV_(CNT). A negative input of the amplifier 810 is coupled to a sourceterminal of the transistor 820 and one terminal of the resistor 825. Theother terminal of the resistor 825 is coupled to the ground. An outputof the amplifier 810 is coupled to agate terminal of the transistor 820.A drain terminal of the transistor 820 is coupled to the first currentmirror and generates a current I₈₂₀.

The first current mirror generates a current I₈₃₁ by mirroring thecurrent I₈₂₀. Source terminals of the transistors 830 and 831 of thefirst current mirror are coupled to the supply voltage V_(CC). Gateterminals of the transistors 830. 831 and drain terminals of thetransistors 830, 820 are connected together. A drain terminal of thetransistor 831 generates the current I₈₃₁. The second current mirror iscoupled to the drain terminal of the transistor 831 to generate acurrent I₈₃₃ by mirroring the current I₈₃₁. Source terminals of thetransistors 832 and 833 of the second current mirror are coupled to theground. Gate terminals of the transistors 832, 833 and drain terminalsof the transistors 832, 831 are connected together. A drain terminal ofthe transistor 833 generates the current I₈₃₃. The current source 850 iscoupled from the supply voltage V_(CC) to the drain terminal of thetransistor 833. The drain terminal of the transistor 833 further outputsthe programmable current I_(CNT). As shown in FIG. 6, the programmablecurrent I_(CNT) is to modulate the current input signal V_(IP). Thecurrent input signal V_(IP) is correlated to the switching current I_(P)of the offline transformer 10 and the programmable signal V_(CNT).

It will be apparent to those skilled in the art that variousmodifications and variations can be made to the structure of the presentinvention without departing from the scope or spirit of the invention.In view of the foregoing, it is intended that the present inventioncover modifications and variations of this invention provided they fallwithin the scope of the following claims and their equivalents.

What is claimed is:
 1. An LED drive circuit comprising: a controller,generating a switching signal coupled to switch a magnetic device thatreceives an input voltage derived from an input of the LED drivecircuit, for generating an output current to drive at least a LED (LightEmitting Diode), wherein the controller comprises: an input circuit,receiving a programmable signal correlated to the input of the LED drivecircuit to generate a programmable current, wherein the programmablecurrent is coupled to modulate a current input signal which iscorrelated to a switching current of the magnetic device to form amodulated current input signal; and a comparison circuit, comparing asignal sourced from an oscillator and a voltage potential generated inresponse to the modulated current input signal for generating a currentcontrol signal, wherein the switching signal is controlled in responseto the current control signal for regulating the output current, and alevel of the output current is correlated to the current control signal.2. The LED drive circuit as claimed in claim 1, wherein the voltagepotential is generated in response to the programmable current.
 3. TheLED drive circuit as claimed in claim 1, wherein the voltage potentialis generated in response to the current input signal.
 4. The LED drivecircuit of claim 1, wherein the LED drive circuit modulates the currentinput signal by adding a voltage formed using the programmable currentto the current input signal.
 5. The LED drive circuit as claimed inclaim 1, wherein the input of the LED drive circuit is an AC input. 6.The LED drive circuit as claimed in claim 5, wherein the LED drivecircuit further comprises: a bridge rectifier having an input forreceiving the AC input, and an output for providing the input voltage;and a first capacitor having a first terminal coupled to the output ofthe bridge rectifier, and a second terminal coupled to ground.
 7. TheLED drive circuit as claimed in claim 6, wherein the LED drive circuitfurther comprises: a first diode, having an anode for receiving a firstcomponent of the AC input, and a cathode; a second diode, having ananode for receiving a second component of the AC input, and cathodecoupled to the cathode of the first diode; a voltage divider having aninput coupled to the cathodes of the first and second diodes, and anoutput for providing the programmable signal; and a second capacitorhaving a first terminal coupled to the cathodes of the first and seconddiodes, and a second terminal coupled to ground.
 8. The LED drivecircuit of claim 1, wherein: the oscillator provides a pulse signal anda ramp signal; the comparison circuit is responsive to the ramp signaland a current signal for providing a current control signal; and thecontroller comprises a PWM circuit responsive to the pulse signal to setthe switching signal to a first logic state, and to the current controlsignal to reset the switching signal to a second logic state.
 9. The LEDdrive circuit of claim 8 wherein the controller further comprises: abuffer amplifier having an input for receiving the current input signal,and an output for providing a buffered current input signal; a resistorhaving a first terminal connected to the output of the buffer amplifier,and a second terminal for providing a modulated current sense signal;and a voltage-to-current converter having an input for receiving theprogrammable signal, and an output coupled to the second terminal of theresistor.
 10. The LED drive circuit of claim 9 wherein the controllerfurther comprises: an integrator for forming the current signal inresponse to the modulated current sense signal.
 11. An LED (LightEmitting Diode) drive circuit comprising: a magnetic device having afirst terminal for receiving an input voltage derived from an input ofthe LED drive circuit, and a second terminal, the magnetic devicegenerating an output current to drive at least one LED; a powertransistor having a drain coupled to the second terminal of the magneticdevice, a control terminal, and a source; a current-sense resistorhaving a first terminal coupled to the source of the power transistorfor forming a current input signal, and a second terminal coupled toground; and a controller having a first input for receiving aprogrammable signal derived from the input of the LED drive circuit, asecond input coupled to the first terminal of the current-senseresistor, and an output coupled to the control terminal of the powertransistor for providing a switching signal thereto, wherein thecontroller forms a current control loop by detecting the current inputsignal and modulating a pulse width of the switching signal in response,and varies an operation of the current control loop in response to theprogrammable signal.
 12. The LED drive circuit of claim 11, wherein themagnetic device comprises: an offline transformer with a primary windinghaving a first end forming the first terminal, a second end forming thesecond terminal, and a secondary winding for generating the outputcurrent to drive the at least one LED.
 13. The LED drive circuit ofclaim 11, wherein the LED drive circuit modulates the current inputsignal by adding a voltage formed using the programmable signal to thecurrent input signal.
 14. The LED drive circuit as claimed in claim 11,wherein the input of the LED drive circuit is an AC input.
 15. The LEDdrive circuit as claimed in claim 14, wherein the LED drive circuitfurther comprises: a bridge rectifier having an input for receiving theAC input, and an output for providing the input voltage; and a firstcapacitor having a first terminal coupled to the output of the bridgerectifier, and a second terminal coupled to ground.
 16. The LED drivecircuit as claimed in claim 15, wherein the LED drive circuit furthercomprises: a first diode, having an anode for receiving a firstcomponent of the AC input, and a cathode; a second diode, having ananode for receiving a second component of the AC input, and cathodecoupled to the cathode of the first diode; a voltage divider having aninput coupled to the cathodes of the first and second diodes, and anoutput for providing the programmable signal; and a second capacitorhaving a first terminal coupled to the cathodes of the first and seconddiodes, and a second terminal coupled to ground.
 17. The LED drivecircuit of claim 11, wherein the controller comprises: an amplifier inthe current control loop having a first input responsive to the currentinput signal, a second input for receiving a reference voltage, and anoutput, wherein the controller modulates the reference voltage inresponse to the programmable signal.
 18. The LED drive circuit of claim17, wherein the controller further comprises: a buffer amplifier havinga positive input for receiving the programmable signal, a negativeinput, and an output coupled to the negative input thereof; a secondresistor having a first terminal coupled to the output of the bufferamplifier, and a second terminal forming the reference voltage; and azener diode having a cathode coupled to the second terminal of thesecond resistor, and an anode coupled to ground.
 19. The LED drivecircuit of claim 11, wherein the controller comprises: a bufferamplifier having an input for receiving a current input signalrepresentative of a current through the magnetic device, and an output;a second resistor having a first terminal coupled to the output of thebuffer amplifier, and a second terminal for providing a modulatedcurrent input signal, wherein the controller using the modulated currentinput signal in the current control loop; and an input circuit, havingan input for receiving the programmable signal, and an output coupled tothe second terminal of the second resistor for providing a programmablecurrent thereto.
 20. The LED drive circuit of claim 19 wherein the inputcircuit comprises: a voltage-to-current converter having an input forreceiving the programmable signal, and an output coupled to the secondterminal of the second resistor.